package ru.papergames.controller.commands
{
	import org.puremvc.as3.interfaces.INotification;
	
	import ru.game.oside.frontend.topviews.fight.mvc.controller.notifications.FightNotifications;
	import ru.game.oside.frontend.topviews.fight.mvc.model.vo.packets.SocketRequest;

	public class SendRequestCommand extends BaseFightCommand
	{
		override public function execute(note:INotification):void {
			if (!this.fightProxy.connected) return;
			
			switch(note.getName()) {
				case FightNotifications.SEND_REQUEST:
					this.fightProxy.send(note.getBody() as SocketRequest);
					break;
					
				case FightNotifications.RESEND_LAST_REQUEST:
					if (this.fightProxy.lastSentPacket) this.fightProxy.send(this.fightProxy.lastSentPacket);
					break;
					
			}			
		}
		
	}
}